/*
 * @Author: funlee
 * @Email: i@funlee.cn
 * @Date: 2018-07-03 09:58:51
 * @Description: Diagrams and Models 
 */
import React, { Component } from 'react';
import go from 'gojs';

export default class App extends Component {
  componentDidMount() {
    const $ = go.GraphObject.make; // 构建 GOJS 对象
    var myDiagram = $(go.Diagram, 'chart',
      {
        'undoManager.isEnabled': true
      }
    )

    var myModel = $(go.Model);
    myModel.nodeDataArray = [
      { key: 'Alpha' },
      { key: 'Beta' },
      { key: 'Gamma' },
    ]

    myDiagram.model = myModel;
  }
  render() {
    return (
      <div id="chart" style={{ width: 800, height: 430, background: '#DAE4E4', margin: '20px auto' }} ref={e => this.chart = e}>

      </div>
    )
  }
}
